package kr.co.dayve.site.management.dao;

import kr.co.dayve.site.domain.CommunityBoard;
import kr.co.dayve.site.domain.Contact;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.util.List;


public class ContactDaoImpl extends SqlMapClientDaoSupport implements ContactDao {
	public String writeContact(Contact contact){
        return Integer.toString(getSqlMapClientTemplate().update("CONTACT.writeContact", contact));
    }

    public List getContactList(Contact contact){
        return getSqlMapClientTemplate().queryForList("CONTACT.getContactList", contact, contact.getCurrentPage() * contact.getPageSize(), contact.getPageSize());
    }

    public String getTotalContact(Contact contact){
        return (String)getSqlMapClientTemplate().queryForObject("CONTACT.getTotalContact", contact);
    }

    public Contact getContactByNo(String contact_no){
        return (Contact)getSqlMapClientTemplate().queryForObject("CONTACT.getContactByNo", contact_no);
    }

    public String updateContact(Contact contact){
        return Integer.toString(getSqlMapClientTemplate().update("CONTACT.updateContact", contact));
    }

}
